package com.ccz.demo.design.subscribe.javautil;

import java.util.Observable;

/**
 * @ClassName Subject
 * @Author caihaoyun
 * @Date 2020/4/2
 * @Version V1.0
 **/
public class Subject extends Observable {

    private int state;

    private String message;


    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
        setChanged();
        notifyObservers();
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
        setChanged(); // 表示目标对象已经做了更改
        notifyObservers(); // 通知所有观察者
    }



}
